Hi all, I'd like to export from DOORS module to MS Word. In the module there is DXL attribute that makes some RTF tables. The DOORS built-in DXL export macro, won't preserve the RTF tables format. In a post in this forum I learned how to fix this: basically when you copy in the clipboard with the prototype setRichClip(Buffer, string, string, bool, bool, bool) something goes wrong with RTF tables (the culprit is the second parameter which holds the Word style name). But if you use the other prototype setRichClip(Buffer,bool) the RTF tables come out right, when pasted in MS Word.
So I tried the snippet I found in ths post Now in a file called c:/my_patched_setRichClipHelper.dxl I have the following code
void setRichClipHelper( Buffer b,
RTF_string__ s,
string styleName,
bool useColour,
string fontTable,
bool styleHasBullet,
bool styleHasIndent,
bool useOleClipboard )
{
//-----------------my patch---------------------------
if(styleName=="Normal"){
if (!null b){
b += "\n" //add newline that gets lost with this patch
}
else{
string str=unicodeString(s,true, false)
s = richText(str "\n")//add newline that gets lost with this patch
}
styleName=null
}
//-----------------end of mypatch---------------------
if (!null styleName) {
if(useColour)
{
if (!null b)
{
setRichClipWithColour(b, styleName, fontTable, !styleHasBullet, !styleHasIndent, useOleClipboard)
}
else
{
setRichClipWithColour(s, styleName, fontTable, !styleHasBullet, !styleHasIndent, useOleClipboard)
}
}
else
{
if (!null b)
{
setRichClip(b, styleName, fontTable, !styleHasBullet, !styleHasIndent, useOleClipboard)
}
else
{
setRichClip(s, styleName, fontTable, !styleHasBullet, !styleHasIndent, useOleClipboard)
}
}
}
else if (!null b)
{
setRichClip(b, useOleClipboard)
}
else
{
setRichClip(s, useOleClipboard)
}
}
And the complete patched export snippet is now
Module m = current
{
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
{
#include <standard/export/office/word.dxl>
#include <c:/my_patched_setRichClipHelper.dxl>
set(exportHeadingsToggle, false) // turn off export of headings
set(exportWarnUnregOLE,false) //turn off ole warning
doExport theDiag
if (!null theDiag) destroy theDiag
}
}
When I run this code, the execution hangs. I guess on the very first call of my patched setRichClipHelper . All DOORS is stalled and I have to forcefully kill the application. Very painfull!
On the contrary, if I make a copy of the file ...\DOORS\9.4\lib\dxl\standard\export\office\word.dxl and modify directly the setRichClipHelper in there, everythig runs smoothly. What am I doing wrong with the snippet? Why the function override is not possible in this case? I wonder if someone has come up with a more elegant solution to this problematic RTF table export? Yes, I know I ca use OLE tables, but I would rather not
pvselex - Thu Oct 15 10:10:11 EDT 2015 |